package com.ny.demo;

class Dog{
    String name;
    int age;
    void makeSound(){
        System.out.println("汪汪");
    }
}

class Cat{
    String name;
    int age;
    void makeSound(){
        System.out.println("喵喵");
    }
}
public class Text {
    public static void main(String[] args) {
        Dog myDog = new Dog();
        myDog.name="旺财";
        myDog.age=3;

        Cat myCat = new Cat();
        myCat.name="咪咪";
        myCat.age=2;

        System.out.println("狗的名字"+myDog.name+",年龄:"+myDog.age);
        myDog.makeSound();
        System.out.println("\n猫的名字"+myCat.name+",年龄:"+myCat.age);
        myCat.makeSound();
    }
}
